<%@ page language="java" import="java.util.*,entity.*,dao.*,dao.impl.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%
request.setCharacterEncoding("utf-8");
String title = request.getParameter("title");
String content =request.getParameter("content");
int boardId =Integer.parseInt(request.getParameter("boardId"));
int topicId =Integer.parseInt(request.getParameter("topicId"));
User user=(User)session.getAttribute("user");
ReplyDao replyDao = new ReplyDaoImpl();

if(user!= null){
	Reply reply =new Reply();
	reply.setTitle(title);
	reply.setContent(content);
	reply.setTopicId(topicId);
	reply.setUid(user.getUId());
	
	replyDao.addReply(reply);
	response.sendRedirect("../detail.jsp?page=1&boardId="+boardId +"&topicId="+topicId);
	return;
}else{
	response.sendRedirect("../login.jsp");
}
 %>